package com.kk.permission.accessibilityutils;

import android.text.TextUtils;
import android.view.accessibility.AccessibilityNodeInfo;

import java.util.List;

public class IsUtil {
    public static boolean isNull(Object obj) {
        return obj == null;
    }

    public static boolean isClickable(AccessibilityNodeInfo accessibilityNodeInfo) {
        return isNonNull(accessibilityNodeInfo) && accessibilityNodeInfo.isClickable();
    }

    public static boolean isScrollable(AccessibilityNodeInfo accessibilityNodeInfo) {
        return isNonNull(accessibilityNodeInfo) && accessibilityNodeInfo.isScrollable();
    }

    public static boolean isEmpty(String str) {
        return TextUtils.isEmpty(str);
    }

    public static boolean isNotEmpty(String str) {
        return TextUtils.isEmpty(str) ^ true;
    }

    public static boolean isNotEmpty(List list) {
        return isNonNull(list) && list.size() > 0;
    }

    public static boolean isEmpty(List list) {
        return isNotEmpty(list) ^ true;
    }

    public static boolean isNonNull(Object obj) {
        return isNull(obj) ^ true;
    }

    public static boolean isNotNullClassName(AccessibilityNodeInfo accessibilityNodeInfo) {
        return isNonNull(accessibilityNodeInfo) && isNonNull(accessibilityNodeInfo.getClassName());
    }
}
